/* Copyright (c) Byron Adams <byron.adams54@gmail.com>
   See the file LICENSE for licensing information. */

translator.service({
  meta : {
    version : "0.0.1",
    shortName : "expressivo",
    name : "Expressivo",
    icon : "",
    desc : "",
    homepage : "http://www.expressivo.com/"
  },

  voice : {
    charLimit : 200,
    url : "http://say.expressivo.com/xivonaonline.php",
    method : "POST",
    params: {
        xajax : "generateVoice",
        client_text : "{{text}}",
        xajaxr : new Date().getTime(),
        "xajaxargs[]" : ["en", "hello", "10", "true", "1"]
    },
    file : function (response) {
        var url = false;
        if (response.match("retour_php=") != null && response.match("@ERROR") == null) {
            url = response.split("retour_php=")[1].split("&file_id=")[0]
        }
        return url;
    }
  }
});


/* 
var text = "The Expressivo application, a popular text-to-speech reader for the Internet, books and documents is now available in 1.5 version. Above all, the application has been enriched with the voices of IVONA";
 
 $.ajax({
    type : "POST",
    url : "http://say.expressivo.com/xivonaonline.php", 
    data : {
        xajax : "generateVoice",
        xajaxr : new Date().getTime(),
        "xajaxargs[]" : ["en", text, "10", "true", "1"]
    },
    success : function (data) {         
        var url = data.documentElement.textContent.split("FlashVars=\"sndfile=")[1].split("&")[0]
        console.log(url);
        $("embed").remove()
        $("body")[0].innerHTML += "<embed src=\"" + url + "\" type=\"audio/mpeg\"/ style=\"height:0px;\"/>";         
    }
});


Voices (3rd xajaxargs param):

Jacek - male Polish voice : 1
Ewa - female Polish voice : 2
Jennifer - female US-English voice : 3
Carmen - female Romanian voice : 4
Eric - male US-English voice : 10








*/

 
